package com.cebbank.yyi.springbootapp.jingtang.service.impl;

import com.cebbank.yyi.springbootapp.jingtang.entity.TDocCate;
import com.cebbank.yyi.springbootapp.jingtang.dao.TDocCateDao;
import com.cebbank.yyi.springbootapp.jingtang.service.TDocCateService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

/**
 * 分类表(TDocCate)表服务实现类
 *
 * @author makejava
 * @since 2024-08-25 15:11:10
 */
@Service("tDocCateService")
public class TDocCateServiceImpl implements TDocCateService {
    @Resource
    private TDocCateDao tDocCateDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public TDocCate queryById(Integer id) {
        return this.tDocCateDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param tDocCate    筛选条件
     * @param pageRequest 分页对象
     * @return 查询结果
     */

    /**
     * 新增数据
     *
     * @param tDocCate 实例对象
     * @return 实例对象
     */
    @Override
    public TDocCate insert(TDocCate tDocCate) {
        this.tDocCateDao.insert(tDocCate);
        return tDocCate;
    }

    /**
     * 修改数据
     *
     * @param tDocCate 实例对象
     * @return 实例对象
     */
    @Override
    public TDocCate update(TDocCate tDocCate) {
        this.tDocCateDao.update(tDocCate);
        return this.queryById(tDocCate.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.tDocCateDao.deleteById(id) > 0;
    }
}
